package com.situ.day13;

import java.awt.GridBagLayout;
import java.awt.GridLayout;

import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

public class XiaLaKuang {
	public static void main(String[] args) {
		JFrame jf = new JFrame();  //新建
		jf.setTitle("测试");		  //窗口名
		jf.setSize(400, 400);	//窗口
		jf.setLocation(500, 300);//位置从左上开始
		jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//设置默认退出操作
		jf.setVisible(true);//把窗口显示在屏幕上
//		jf.setResizable(false);//固定窗口大小，禁止拖拽
		
		//新建
		JPanel Panel = new JPanel();
		jf.add(Panel);
		//布局
		Panel.setLayout(new GridLayout(2, 1));
		
		//选择籍贯
		JPanel jiGuanPanel = new JPanel();
		JLabel jiGuanLabel = new JLabel("籍贯");
		String[] homes = {"北京", "杭州", "上海", "深圳"};
		JComboBox comboBox = new JComboBox(homes);
		jiGuanPanel.add(jiGuanLabel);
		jiGuanPanel.add(comboBox);
		Panel.add(jiGuanPanel);
		//选择学习语言
		JPanel  listPanel = new JPanel();
		JLabel  listLabel = new JLabel("语言");
		String[] yuyan = {"JAVA","C","Android","PHP","Python"};
		JList<String> list = new JList<>(yuyan);
		//设置显示几个
		list.setVisibleRowCount(3);
		JScrollPane scrollPane = new JScrollPane(list);
		listPanel.add(scrollPane);
		Panel.add(listPanel);
	}
	
	
}
